package main.java.indi.zyj.sword;

import java.util.ArrayList;
import java.util.List;

public class FileCombination {

    public int[][] fileCombination(int target) {

        List<int []> res = new ArrayList<>();
        int left = 1, right = 2;

        while (left < right) {

            int sum = (right - left + 1) * (left + right) / 2;

            if (sum == target) {
                int[] temp = new int[right - left + 1];
                for (int i = 0; i < temp.length; i++) {
                    temp[i] = left + i;
                }
                res.add(temp);
                left++;
            } else if (sum < target) {
                right++;
            } else {
                left++;
            }
        }

        return res.toArray(new int[res.size()][]);


    }

}
